<template>
  <div>
    <el-card class="box-card">
<!--      <el-button-->
<!--        class="btn-add"-->
<!--        @click="handleUpdateProduct()"-->
<!--        size="mini">-->
<!--        添加-->
<!--      </el-button>-->
      <el-input
        style="width: 300px"
        placeholder="请输入内容"
        v-model="input"
        clearable
        size="mini">
      </el-input>
      <el-button
        class="btn-add"
        @click="quzzyQuery()"
        size="mini">
        查询
      </el-button>
    </el-card>

<!--   基本表-->
    <el-table ref="productTable"
              style="width: 100%"
              :data="productList"
              border>
<!--      <el-table-column type="selection" width="60" align="center"></el-table-column>-->
<!--      <el-table-column-->
<!--        type="index">-->
<!--      </el-table-column>-->
      <el-table-column label="操作" width="160" align="center">
        <template slot-scope="scope">
          <p>
<!--            <el-button-->
<!--              size="mini"-->
<!--              @click="handleUpdateProduct(scope.$index, scope.row)"> 编辑-->
<!--            </el-button>-->
<!--            <br>-->
            <el-button
              size="mini"
              @click="orderLook(scope.$index, scope.row)">查看详情
            </el-button>
            <br>
            <el-button
              v-show="scope.row.orderStatus>2"
              size="mini"
              @click="kdLook(scope.$index, scope.row)">查看物流
            </el-button>
            <br>

            <el-button
              v-show="scope.row.orderStatus==2"
              size="mini"
              @click="sendKd(scope.$index, scope.row)">发货
            </el-button>
          </p>
        </template>
      </el-table-column>
      <el-table-column label="订单号" width="100" prop="orderId" align="center">
      </el-table-column>
      <el-table-column label="订单状态" width="100" prop="orderStatusName" align="center"
                       :filters="[{text: '未支付', value: '未支付'}, {text: '待发货', value: '待发货'}, {text: '待收货', value: '待收货'}, {text: '已完成', value: '已完成'}, {text: '售后', value: '售后'}]"
                       :filter-method="filterHandler">
        <template slot-scope="scope">
          <el-tag
            v-show="scope.row.orderStatus==5"
            type="danger"
            disable-transitions>{{scope.row.orderStatusName}}</el-tag>
          <el-tag
            v-show="scope.row.orderStatus==4"
            type="success"
            disable-transitions>{{scope.row.orderStatusName}}</el-tag>
          <el-tag
            v-show="scope.row.orderStatus!=4 && scope.row.orderStatus!=5"
            disable-transitions>{{scope.row.orderStatusName}}</el-tag>
        </template>
      </el-table-column>


      <el-table-column label="用户编号" width="100" prop="userId" align="center">
      </el-table-column>
      <el-table-column label="店铺编号" width="100" prop="merchantId" align="center">
      </el-table-column>
      <el-table-column label="商品编号" width="100" prop="spuId" align="center">
      </el-table-column>
      <el-table-column label="服务编号" width="100" prop="serviceEnsureId" align="center">
      </el-table-column>
      <el-table-column label="销售规格编号" width="120" prop="skuId" align="center">
      </el-table-column>
      <el-table-column label="物流编号" width="100" prop="logisticslId" align="center">
      </el-table-column>
      <el-table-column label="物流公司编码" width="120" prop="logisticslCode" align="center">
      </el-table-column>
      <el-table-column label="成交金额" width="100" prop="orderMoney" align="center">
      </el-table-column>

      <el-table-column label="商品名称" width="100" prop="spuName" align="center">
      </el-table-column>
      <el-table-column label="商品单价" width="100" prop="spuMoney" align="center">
      </el-table-column>
      <el-table-column label="商品规格" width="100" prop="spuNorms" align="center">
      </el-table-column>
      <el-table-column
        prop="normsImg"
        label="商品图片" width="150" align="center">
        <template slot-scope="scope">
          <img :src="scope.row.normsImg" width="100" height="50px">
        </template>
      </el-table-column>
      <el-table-column label="商品数量" width="100" prop="merchantNum" align="center">
      </el-table-column>
      <el-table-column label="优惠券ID" width="100" prop="merchantCouponId" align="center">
      </el-table-column>
      <el-table-column sortable label="下单时间" width="110" :formatter="dateFormatter" prop="orderTime" align="center">
      </el-table-column>
      <el-table-column sortable label="支付时间" width="110" :formatter="dateFormatter" prop="payTime" align="center">
      </el-table-column>
      <el-table-column sortable label="发货时间" width="110" :formatter="dateFormatter" prop="deliveryTime" align="center">
      </el-table-column>
      <el-table-column sortable label="收货时间" width="110" :formatter="dateFormatter" prop="receivingTime" align="center">
      </el-table-column>
      <el-table-column label="订单备注" width="100" prop="orderRemarks" align="center">
      </el-table-column>
      <el-table-column label="支付方式" width="100" prop="payMode" align="center">
      </el-table-column>
      <el-table-column label="交易号" width="100" prop="transactionNum" align="center">
      </el-table-column>
      <el-table-column label="运费" width="100" prop="freight" align="center">
      </el-table-column>
      <el-table-column label="收货地址" width="100" prop="shippingAddress" align="center">
      </el-table-column>
      <el-table-column label="收件人" width="100" prop="addresseee" align="center">
      </el-table-column>
      <el-table-column label="收件人电话" width="100" prop="phone" align="center">
      </el-table-column>
<!--      <el-table-column label="收件人" width="100" prop="addresseee" align="center">-->
<!--      </el-table-column>-->

    </el-table>
    <el-pagination
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="this.page.currentPage"
      layout="total, prev, pager, next, jumper"
      :total="this.page.total">
    </el-pagination>
<!--编辑-->
    <el-dialog
      :title="dialogTitle"
      :visible.sync="dialogVisible"
      width="33%">
      <el-form ref="productAttrCatForm" :model="this.Form" :rules="rules" label-width="120px">
        <el-form-item label="订单状态" prop="orderStatusName"  >
<!--          <el-input v-model="Form.orderStatusName" auto-complete="off" ></el-input>-->
            <el-select v-model="value" placeholder="请选择" >
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
                @click.native="statusChange(item.value)">
              </el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="收货地址" prop="shippingAddress" >
          <el-input v-model="Form.shippingAddress" auto-complete="off" ></el-input>
        </el-form-item>
        <el-form-item label="收件人" prop="addresseee" >
          <el-input v-model="Form.addresseee" auto-complete="off" ></el-input>
        </el-form-item>
        <el-form-item label="收件人电话" prop="phone" >
          <el-input v-model="Form.phone" auto-complete="off" ></el-input>
        </el-form-item>
        <el-form-item label="物流编号" prop="logisticslId" >
          <el-input v-model="Form.logisticslId" auto-complete="off" ></el-input>
        </el-form-item>
        <el-form-item label="物流公司编码" prop="logisticslCode" >
          <el-input v-model="Form.logisticslCode" auto-complete="off" ></el-input>
        </el-form-item>
        <el-form-item label="订单号" prop="orderId" >
          <el-input v-model="Form.orderId" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="用户编号" prop="userId" >
          <el-input v-model="Form.userId" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="店铺编号" prop="merchantId" >
          <el-input v-model="Form.merchantId" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="商品编号" prop="merchantId" >
          <el-input v-model="Form.merchantId" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="服务编号" prop="serviceEnsureId" >
          <el-input v-model="Form.serviceEnsureId" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="销售规格编号" prop="skuId" >
          <el-input v-model="Form.skuId" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>

        <el-form-item label="成交金额" prop="orderMoney" >
          <el-input v-model="Form.orderMoney" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>

        <el-form-item label="商品名称" prop="spuName" >
          <el-input v-model="Form.spuName" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="商品单价" prop="spuMoney" >
          <el-input v-model="Form.spuMoney" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="商品规格" prop="spuNorms" >
          <el-input v-model="Form.spuNorms" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="商品图片" prop="normsImg"  >
          <el-image
            style="width: 100px; height: 100px"
            :src="Form.normsImg"
            :preview-src-list="srcList"
          >
          </el-image>
        </el-form-item>
        <el-form-item label="商品数量" prop="merchantNum" >
          <el-input v-model="Form.merchantNum" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="优惠券ID" prop="merchantCouponId" >
          <el-input v-model="Form.merchantCouponId" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="下单时间" prop="orderTime" >
          <el-input v-model="Form.orderTime" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="支付时间" prop="dateFormatter" >
          <el-input v-model="Form.dateFormatter" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="发货时间" prop="dateFormatter" >
          <el-input v-model="Form.dateFormatter" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="收货时间" prop="receivingTime" >
          <el-input v-model="Form.receivingTime" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="订单备注" prop="orderRemarks" >
          <el-input v-model="Form.orderRemarks" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="支付方式" prop="payMode" >
          <el-input v-model="Form.payMode" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="交易号" prop="transactionNum" >
          <el-input v-model="Form.transactionNum" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="运费" prop="freight" >
          <el-input v-model="Form.freight" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>

      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="handleConfirm(Form)">确 定</el-button>
      </span>
    </el-dialog>
<!--查看详情-->
    <el-dialog
      :title="lookOrderTitle"
      :visible.sync="lookOrderVisible"
      width="33%">
      <el-form ref="lookForm" :model="this.lookOrderData"  label-width="120px">

        <el-form-item label="订单号" prop="orderId" >
          <el-input v-model="lookOrderData.orderId" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="用户编号" prop="userId" >
          <el-input v-model="lookOrderData.userId" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="店铺编号" prop="merchantId" >
          <el-input v-model="lookOrderData.merchantId" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="商品编号" prop="merchantId" >
          <el-input v-model="lookOrderData.merchantId" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="服务编号" prop="serviceEnsureId" >
          <el-input v-model="lookOrderData.serviceEnsureId" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="销售规格编号" prop="skuId" >
          <el-input v-model="lookOrderData.skuId" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="物流编号" prop="logisticslId" >
          <el-input v-model="lookOrderData.logisticslId" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="物流公司编码" prop="logisticslCode" >
        <el-input v-model="lookOrderData.logisticslCode" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="成交金额" prop="orderMoney" >
          <el-input v-model="lookOrderData.orderMoney" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="订单状态" prop="orderStatusName" >
          <el-input v-model="lookOrderData.orderStatusName" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="商品名称" prop="spuName" >
          <el-input v-model="lookOrderData.spuName" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="商品单价" prop="spuMoney" >
          <el-input v-model="lookOrderData.spuMoney" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="商品规格" prop="spuNorms" >
          <el-input v-model="lookOrderData.spuNorms" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="商品图片" prop="normsImg"  >
          <el-image
            style="width: 100px; height: 100px"
            :src="lookOrderData.normsImg"
            :preview-src-list="srcList"
            >
          </el-image>
        </el-form-item>
        <el-form-item label="商品数量" prop="merchantNum" >
          <el-input v-model="lookOrderData.merchantNum" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="优惠券ID" prop="merchantCouponId" >
          <el-input v-model="lookOrderData.merchantCouponId" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="下单时间" prop="orderTime" >
          <el-input v-model="lookOrderData.orderTime" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="支付时间" prop="dateFormatter" >
          <el-input v-model="lookOrderData.dateFormatter" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="发货时间" prop="dateFormatter" >
          <el-input v-model="lookOrderData.dateFormatter" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="收货时间" prop="receivingTime" >
          <el-input v-model="lookOrderData.receivingTime" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="订单备注" prop="orderRemarks" >
          <el-input v-model="lookOrderData.orderRemarks" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="支付方式" prop="payMode" >
          <el-input v-model="lookOrderData.payMode" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="交易号" prop="transactionNum" >
          <el-input v-model="lookOrderData.transactionNum" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="运费" prop="freight" >
          <el-input v-model="lookOrderData.freight" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="收货地址" prop="shippingAddress" >
          <el-input v-model="lookOrderData.shippingAddress" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="收件人" prop="addresseee" >
          <el-input v-model="lookOrderData.addresseee" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="收件人电话" prop="phone" >
          <el-input v-model="lookOrderData.phone" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
      </el-form>
    </el-dialog>
<!--物流详细-->
    <el-dialog
      :title="kdLookTitle"
      :visible.sync="kdLookVisible"
      width="33%">
      <el-form ref="lookForm" :model="this.kdLookData"  label-width="120px">

        <el-form-item label="物流公司" prop="logisticslCodeName" >
          <el-input v-model="kdLookData.logisticslCodeName" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>
        <el-form-item label="物流单号" prop="logisticslId" >
          <el-input v-model="kdLookData.logisticslId" auto-complete="off" :disabled="true"></el-input>
        </el-form-item>

        <el-form-item label="物流轨迹" prop="kdData" >
          <template slot-scope="scope">
            <el-timeline>
              <el-timeline-item
                v-for="(activity, index) in activities"
                :key="index"
                :color="activity.activi.color"
                :timestamp="activity.activi.timestamp">
                {{activity.activi.content}}
              </el-timeline-item>
            </el-timeline>
          </template>
        </el-form-item>
      </el-form>
    </el-dialog>

    <el-dialog
      :title="kdTitle"
      :visible.sync="kdVisible"
      width="33%">
      <el-form ref="lookForm" :model="this.kdData"  label-width="120px">

        <el-form-item label="物流公司" prop="logisticslCodeName" >
          <el-select v-model="kdValue" placeholder="请选择" >
            <el-option
              v-for="item in kdoptions"
              :key="item.value"
              :label="item.label"
              :value="item.value"
              @click.native="kdStatusChange(item.value)">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="物流单号" prop="logisticslId" >
          <el-input v-model="kdData.logisticslId" auto-complete="off" ></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
      <el-button @click="kdFoomlose()">取 消</el-button>
      <el-button type="primary" @click="sendOK(kdData)">确 定</el-button>
      </span>
    </el-dialog>

  </div>
</template>

<script>
    import moment from 'moment'
    import axios from "axios"
    import Cookie from "js-cookie"
    export default {
        name: "kindsList",
        data() {
            return {
                input:"",
                productList: [],
                kindStatus: false,
                AdddialogVisible:false,
                dialogTitle: "",
                lookOrderTitle:"",
                lookOrderVisible:false,
                lookOrderData:{},
                kdLookTitle:"",
                kdLookVisible:false,
                kdLookData:{},
                activities:[],
                srcList: [],
                dialogVisible: false,
                userId: "1",
                mo:false,
                Form: {},
                ddddddd: {},
                page: {
                    currentPage:1,
                    total: 0,
                    page: 0,
                    rows: 10,
                },
                rules: {
                    addresseee: [
                        {required: true, message: '请输入收件人', trigger: 'blur'}
                    ],
                    phone: [
                        {required: true, message: '请输入收件人电话', trigger: 'blur'}
                    ],
                    shippingAddress: [
                        {required: true, message: '请输入收件人地址', trigger: 'blur'}
                    ]
                },
                options: [{
                    value: '1',
                    label: '未支付'
                }, {
                    value: '2',
                    label: '待发货'
                }, {
                    value: '3',
                    label: '待收货'
                }, {
                    value: '4',
                    label: '已完成'
                }, {
                    value: '5',
                    label: '售后'
                }],
                value: '',
                kdTitle:"",
                kdVisible:false,
                kdData:{},
                kdRules: {
                    logisticslCodeName: [
                        {required: true, message: '请选择物流公司', trigger: 'blur'}
                    ],
                    logisticslId: [
                        {required: true, message: '请输入物理单号', trigger: 'blur'}
                    ]
                },
                kdoptions: [{
                    value: 'SF',
                    label: '顺丰速运'
                }, {
                    value: 'HTKY',
                    label: '百世快递'
                }, {
                    value: 'ZTO',
                    label: '中通快递'
                }, {
                    value: 'STO',
                    label: '申通快递'
                }, {
                    value: 'YTO',
                    label: '圆通速递'
                }, {
                    value: 'YD',
                    label: '韵达速递'
                }],
                kdValue: ''
            }
        },
        created() {
            // let listdata = this.$route.params.item;
            // if (listdata != null) {
            //     this.userId = listdata;
            // }
            let merchant = Cookie.get("merchant");
            let information = JSON.parse(merchant);
            console.log(information);
            this.userId=information.merchantId;
            this.getList();
        },
        methods: {
            kdFoomlose(){
                this.kdVisible=false;
            },
            sendOK(data){
                console.log("222")
                console.log(this.kdData)
                this.$axios({
                    method: 'put',
                    url: 'http://localhost:8201/order/sendKd',
                    data: this.kdData,
                }).then(result => {
                    if (result.data!="") {
                        this.$message({
                            showClose: true,
                            message: '操作成功',
                            type: 'success'
                        });
                    } else {
                        this.$message({
                            showClose: true,
                            message: '操作失败',
                            type: 'error'
                        });
                    }
                })
                this.kdData= {};
                this.kdVisible=false;
                this.getList();
            },
            sendKd(index, row){
                let _obj = JSON.stringify(row);
                this.kdData=JSON.parse(_obj);
                this.kdVisible=true;
                // this.kdValue=this.kdData.logisticslCode;

            },
            kdStatusChange(value){
                console.log(value)
                this.kdData.logisticslCode=value;
            },
            statusChange(value1){
                console.log(value1)

                let dsb = JSON.stringify(this.Form);
                this.ddddddd=JSON.parse(dsb);
                this.ddddddd.orderStatus=value1;
                console.log(this.ddddddd)
                // this.$set(this.Form, "orderStatus", value1);
                this.$forceUpdate()
            },
            filterHandler (value, row, column) {
                const property = column["property"]
                return row[property] === value
            },
            // 初始页currentPage、初始每页数据数pagesize和数据data
            handleSizeChange: function (size) {
                this.page.rows = size;
                console.log(this.page.rows)  //每页下拉显示数据
            },
            handleCurrentChange: function(currentPage){
                this.page.currentPage = currentPage;
                this.page.page=(currentPage*this.page.rows)-this.page.rows
                if(this.mo==true){
                    this.quzzyQuery()
                }else{
                    this.getList();
                }
                console.log(this.page.currentPage)  //点击第几页
            },
            quzzyQuery() {
                this.mo=true
                axios.get("http://localhost:8201/order/dimMerchantQueryOrder", {
                    params: {
                        value: this.input,
                        merchantId: this.userId,
                        page: this.page.page,
                        rows: this.page.rows
                    }
                }).then(data => {
                    console.log(data)
                    if (data.data.list == null || data.data.list == "") {
                        this.$message({
                            message: '未查询到有关数据'
                        });
                        this.mo=false;
                        this.getList();
                    } else {
                        this.productList = data.data.list;
                        this.page.total = data.data.total;
                    }
                });
            },
            handleConfirm(kindsForm) {
                //表单校验
                this.$refs["productAttrCatForm"].validate((tt=>{
                    console.log(tt)
                    if (!tt) return;

                    if (this.dialogTitle == "添加") {
                        console.log(kindsForm)
                        this.$axios({
                            method: 'post',
                            url: 'http://localhost:8001/foot/mySave',
                            data: kindsForm,
                        }).then(result => {
                            console.log(result)
                            if (result.data) {
                                this.$message({
                                    showClose: true,
                                    message: '添加成功',
                                    type: 'success'
                                });
                            } else {
                                this.$message({
                                    showClose: true,
                                    message: '填写错误或已存在',
                                    type: 'error'
                                });
                            }
                            this.Form = {};
                            this.dialogVisible = false;
                            this.getList();
                        })
                    } else if (this.dialogTitle == "编辑") {
                        this.$axios({
                            method: 'put',
                            url: 'http://localhost:8201/order',
                            data: this.ddddddd,
                        }).then(result => {
                            if (result.data!="") {
                                this.$message({
                                    showClose: true,
                                    message: '添加成功',
                                    type: 'success'
                                });
                            } else {
                                this.$message({
                                    showClose: true,
                                    message: '填写错误或已存在',
                                    type: 'error'
                                });
                            }

                            this.Form = {};
                            this.dialogVisible = false;
                            this.getList();
                        })
                    }

                }))

            },
            dateFormatter(row, column) {
                var date = row[column.property];
                if (date == undefined) {
                    return ''
                }
                ;
                return moment(date).format("YYYY-MM-DD HH:mm:ss")
            },
            getAttrList(index, row) {
                this.$router.push({path: '/attr/spuAttrList', query: {kindsId: row.kindsId}})
            },
            getList() {

                axios.get("http://localhost:8201/order/merchantQueryOrder", {
                    params: {
                        merchantId: this.userId,
                        page: this.page.page,
                        rows: this.page.rows
                    }
                }).then(result => {
                    console.log(result)
                    this.productList = result.data.list;
                    this.page.total = result.data.total;
                })
            },
            /*删除*/
            handleDelete(index, row) {
                // var kindStatus=row.homeStatus==1?1:0;
                var bean = {
                    id: row.collectId,
                    spuId: row.spuId,
                    userId: row.userId, collectStatus: 0
                }
                // console.log(kindStatus)
                this.$axios({
                    method: 'delete',
                    url: 'http://localhost:8001/foot/mydelete',
                    data: bean
                }).then(result => {
                    this.getList();
                })
            },
            /*编辑*/
            handleUpdateProduct(index, row) {
                this.dialogVisible = true;
                if (row == undefined || row == '') {
                    this.dialogTitle = "添加";
                    this.Form = {};
                    // this.kindsForm.kindsId='';
                } else {
                    this.dialogTitle = "编辑";
                    this.Form = row;

                    this.value=row.orderStatusName;
                    this.srcList[0]=row.normsImg;
                }
            },
            /*查看单条*/
            orderLook(index, row) {
                this.lookOrderVisible=true;
                this.srcList[0]=row.normsImg;
                console.log("handleShowKinds", row);
                this.lookOrderData=row;
            },
            kdLook(index, row) {


                this.kdLookVisible=true;
                // this.srcList[0]=row.normsImg;
                console.log("handleShowKinds", row);
                if(row.logisticslCode=="SF"){
                    row.logisticslCodeName="顺丰速运"
                }else if(row.logisticslCode=="HTKY"){
                    row.logisticslCodeName="百世快递"
                }else if(row.logisticslCode=="ZTO"){
                    row.logisticslCodeName="中通快递"
                }else if(row.logisticslCode=="STO"){
                    row.logisticslCodeName="申通快递"
                }else if(row.logisticslCode=="YTO"){
                    row.logisticslCodeName="圆通速递"
                }else if(row.logisticslCode=="YD"){
                    row.logisticslCodeName="韵达速递"
                }
                this.kdLookData=row;
                axios.get("http://localhost:8201/kdniao/kdQuery", {

                    params: {
                        // id: this.userId,
                        code: row.logisticslCode,
                        no: row.logisticslId
                    }
                }).then(result => {
                    console.log(result)
                    for (let i = 0; i < result.data.Traces.length; i++) {
                        let activi = {};
                        activi.color="#0bbd87"
                        activi.timestamp= result.data.Traces[i].AcceptTime;
                        activi.content= result.data.Traces[i].AcceptStation;
                        this.activities.push({activi});
                    }
                    console.log("ttttttt")
                    console.log(this.activities)
                    // this.kdLookData.Traces = result.data.Traces;
                })

            }
        }
    }
</script>

<style scoped>
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }

  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }

  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }

  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
</style>
